import java.util.ArrayList;

public class Stock extends Security {

	private int stockId;
	private int accountId;
	private int portfolioId;
	private String stockName;
	private String stockDesc;
	private double stockPrice;
	private companyAccountType companyAccountType;
	private int availableStockQuantity;

	public Stock() {
	}

	public companyAccountType getCompanyAccountType() {
		return companyAccountType;
	}

	public void setCompanyAccountType(companyAccountType companyAccountType) {
		this.companyAccountType = companyAccountType;
	}

	public int getAvailableStockQuantity() {
		return availableStockQuantity;
	}

	public void setAvailableStockQuantity(int availableStockQuantity) {
		this.availableStockQuantity = availableStockQuantity;
	}

	public int getAccountId() {
		return accountId;
	}

	public void setAccountId(int accountId) {
		this.accountId = accountId;
	}

	public int getPortfolioId() {
		return portfolioId;
	}

	public void setPortfolioId(int portfolioId) {
		this.portfolioId = portfolioId;
	}

	public Stock(int stockId) {
		this.stockId = stockId;
	}

	public double getStockPrice() {
		return stockPrice;
	}

	public void setStockPrice(double stockPrice) {
		this.stockPrice = stockPrice;
	}

	public int getStockId() {
		return stockId;
	}

	public void setStockId(int stockId) {
		this.stockId = stockId;
	}

	public String getStockName() {
		return stockName;
	}

	public void setStockName(String stockName) {
		this.stockName = stockName;
	}

	public String getStockDesc() {
		return stockDesc;
	}

	public void setStockDesc(String stockDesc) {
		this.stockDesc = stockDesc;
	}

	public void addSecurity(int stockId, double stockPrice) {
		this.stockId = stockId;
		stockName = "StockName_" + stockId;
		stockDesc = "StockDesc_" + stockId;
		this.stockPrice = stockPrice;
		StockRepository stockRepository = StockRepository.getStockRepository();
		stockRepository.addStock(this);

		Queue queue = new Queue(stockId, stockPrice);

		QueueRepository queueRepository = QueueRepository.getOrderRepository();
		queueRepository.addQueue(queue);
	}

	public void listSecurity() {
		for (Stock stock : StockRepository.getStockRepository().getStocks()) {
			System.out.println("\nStock Id: " + stock.getStockId());
			System.out.println("Stock Name: " + stock.getStockName());
			System.out.println("Stock Desc: " + stock.getStockDesc());
			System.out.println("Stock Price: " + stock.getStockPrice());
		}
	}

	public static void listStocks(ArrayList<Stock> stocks) {
		for (Stock stock : stocks) {
			System.out.println("\nStock Id: " + stock.getStockId());
			System.out.println("Stock Name: " + stock.getStockName());
			System.out.println("Stock Desc: " + stock.getStockDesc());
			System.out.println("Stock Price: " + stock.getStockPrice());
		}
	}

}
